package kr.pe.johnkim.carrotpoint.mobile.dao;

import kr.pe.johnkim.carrotpoint.mobile.domain.CarrotPointBusinessKind;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Carrot Point 가맹점 업종 관련 dao 클래스 이다.
 *
 * @author : John_Kim <cale9797@gmail.com>
 * @date : 13. 2. 6.
 */
@Repository
public class CarrotPointBusinessKindDaoImpl extends SqlSessionDaoSupport implements CarrotPointBusinessKindDao {

    // SLF4J Logging
    private Logger logger = LoggerFactory.getLogger(CarrotPointBusinessKindDaoImpl.class);

    /**
     * 가맹점 업종을 등록 한다.
     *
     * @param carrotPointBusinessKind
     */
    @Override
    public void registerBusinessKind(CarrotPointBusinessKind carrotPointBusinessKind) {
        logger.info("registerBusinessKind");
        this.getSqlSession().insert("CARROTPOINT_BUSINESS_KIND.registerBusinessKind", carrotPointBusinessKind);
    }

    /**
     * 가맹점 업종 목록을 가져 온다.
     *
     * @param carrotPointBusinessKind
     * @return
     */
    @Override
    public List<CarrotPointBusinessKind> getBusinessKindList(CarrotPointBusinessKind carrotPointBusinessKind) {
        logger.info("getBusinessKindList");
        return this.getSqlSession().selectList("CARROTPOINT_BUSINESS_KIND.getBusinessKindList", carrotPointBusinessKind);
    }

    /**
     * 가맹점 업종 내용을 업데이트 한다.
     *
     * @param carrotPointBusinessKind
     */
    @Override
    public void updateBusinessKind(CarrotPointBusinessKind carrotPointBusinessKind) {
        logger.info("updateBusinessKind");
        this.getSqlSession().update("CARROTPOINT_BUSINESS_KIND.updateBusinessKind", carrotPointBusinessKind);
    }

    /**
     * 가맹점 업종 활성화 여부를 업데이트 한다.
     *
     * @param carrotPointBusinessKind
     */
    @Override
    public void updateBusinessKindActivateYn(CarrotPointBusinessKind carrotPointBusinessKind) {
        logger.info("updateBusinessKindActivateYn");
        this.getSqlSession().update("CARROTPOINT_BUSINESS_KIND.updateBusinessKindActivateYn", carrotPointBusinessKind);
    }
}
